package com.zwb.demo.easyweb.modules.database.entity;

import com.zwb.demo.easyweb.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;

/**
 * 数据库列
 */
@Table(name = "t_database_column")
@Data
@EqualsAndHashCode(callSuper = true)
@Entity
@GenericGenerator(name = "jpa-uuid", strategy = "uuid")
public class DatabaseColumnPO extends BaseEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @Id
    @GeneratedValue(generator = "jpa-uuid")
    @Column(name = "id", insertable = false, nullable = false , length = 32)
    private String id;

    /**
     * 表id
     */
    @Column(name = "table_id", nullable = false)
    private String tableId;

    /**
     * 列名
     */
    @Column(name = "column_name", nullable = false)
    private String columnName;

    /**
     * 物理类型
     */
    @Column(name = "column_type", nullable = false)
    private String columnType;

    /**
     * 列描述
     */
    @Column(name = "column_desc")
    private String columnDesc;

    /**
     * 是否主键
     */
    @Column(name = "column_key")
    private Boolean columnKey;

    /**
     * 排序
     */
    @Column(name = "column_order")
    private Integer columnOrder;

    /**
     * 是否为空
     */
    @Column(name = "is_nullable", nullable = false)
    private Boolean nullable;

    /**
     * java类型
     */
    @Column(name = "java_type")
    private String javaType;

    /**
     * java名
     */
    @Column(name = "java_name")
    private String javaName;

    /**
     * 表单验证
     */
    @Column(name = "form_display")
    private Boolean formDisplay = false;

    /**
     * 验证可空
     */
    @Column(name = "validate_nullable")
    private Boolean validateNullable = false;

    /**
     * 验证最小长度
     */
    @Column(name = "validate_min_length")
    private Integer validateMinLength ;

    /**
     * 验证最大长度
     */
    @Column(name = "validate_max_length")
    private Integer validateMaxLength ;

    /**
     * 验证最小值
     */
    @Column(name = "validate_min_value")
    private Integer validateMinValue ;
    /**
     * 验证最大值
     */
    @Column(name = "validate_max_value")
    private Integer validateMaxValue ;

    /**
     * 表格展示
     */
    @Column(name = "table_display")
    private Boolean tableDisplay = true;
    
}